/* stylelint-disable no-descending-specificity */
@use '../variables.scss' as *;

@mixin input-focus {
  border: 1px solid $primary-color !important;
  box-shadow: 0 0 0 3px rgb(5 145 255 / 10%) !important;
}

:root {
  --el-color-primary: #{$primary-color} !important;
  --el-color-success: #{$success-color} !important;
  --el-color-warning: #{$warning-color} !important;
  --el-color-danger: #{$error-color} !important;
  --el-color-error: #{$error-color} !important;
  --el-color-text: #{$text-content-color} !important;
  --el-text-color-regular: #{$text-content-color} !important;
  --el-bg-color: #{$bg-color} !important;
  --el-menu-item-height: #{$menu-item-height} !important;
  --el-menu-sub-item-height: calc(var(#{$menu-item-height}) - 6px) !important;
}

// popper提示框
.el-dropdown__popper {
  /* stylelint-disable-next-line custom-property-pattern */
  --el-dropdown-menuItem-hover-fill: #{$el-dropdown-menu-item};
  /* stylelint-disable-next-line custom-property-pattern */
  --el-dropdown-menuItem-hover-color: #{$text-content-color};
}

// 表格样式
.el-table {
  .el-link__inner {
    font-size: 13px;
  }

  .el-table__header {
    .el-table__cell {
      padding: 12px 0;
      background-color: $bg-color;
    }

    .cell {
      color: $text-content-color;
    }
  }

  .el-table__body {
    .el-table__row {
      background-color: #ffffff !important;
    }

    .el-table__cell {
      padding: 12px 0;
    }
  }

  .el-text {
    cursor: pointer;
  }
}

// 树形结构样式
.el-tree {
  .el-tree-node {
    &.is-current {
      .el-tree-node__label {
        color: $primary-color;
      }
    }
  }
}

.el-form {
  .el-select {
    min-width: 200px;
  }
}

// 模态框
.el-dialog {
  --el-dialog-margin-top: 10vh !important;
  border-radius: 6px;

  .el-dialog__header {
    margin-right: 0;
    border-bottom: 1px solid #ebeef5;
  }

  .el-dialog__body {
    padding: 20px 16px;
  }

  .el-dialog__footer {
    padding: 20px 16px;
  }

  .el-form {
    .el-form-item__label {
      font-weight: normal;
    }

    .suffix-item {
      .el-input {
        width: calc(100% - 30px) !important;
      }

      .suffix-name {
        display: inline-block;
        width: 30px;
        text-align: center;
      }
    }

    .el-form-item__content {
      .el-input,
      .el-select {
        width: 100%;
      }
    }

    .el-date-editor {
      .el-input__wrapper {
        width: 100%;
      }
    }
  }
  background: #ffffff !important;

  .file-upload-item {
    .el-form-item__content > div {
      width: 100%;
    }
  }
}

// 抽屉
.el-drawer {
  .el-drawer__header {
    margin-bottom: 0;
    padding: 15px 20px;

    .el-drawer__title {
      line-height: 30px;
    }
    border-bottom: 1px solid $border-color;
  }
  background: #ffffff !important;

  .el-drawer__footer {
    border-top: 1px solid $border-color;
    padding-top: 0;
    padding-bottom: 0;
  }
}

// 卡片
.el-card {
  border: none !important;

  .el-card__header {
    padding: 14px 16px;
    color: $title-color;
  }
}

.el-input__inner::selection {
  color: #ffffff;
  background: #3367d1;
}

.el-tree--highlight-current
  .el-tree-node.is-current
  > .el-tree-node__content
  > .el-tree-node__label {
  color: $primary-color;
}

// 表单项
.el-form.el-form--inline {
  .el-form-item {
    margin-right: 16px;
  }
}

// 分页
.el-pagination.is-background {
  .number,
  .more,
  button {
    color: $sub-color;
    border: 1px solid $border-color;
    background-color: #ffffff !important;

    &.is-active {
      color: #2d8cf0 !important;
      font-weight: normal;
      border: 1px solid $primary-color;
    }
  }
}

// 输入框
.el-input {
  .el-input__wrapper {
    transition: border-color 0.2s ease-in-out;
    box-shadow: none !important;
    border: 1px solid #dcdfe6;

    &.is-focus {
      @include input-focus;
    }
  }
}

// 下拉选择框
.el-select {
  .el-input.is-focus .el-input__wrapper {
    @include input-focus;
  }
}

// 选项卡
.el-tabs {
  .el-tabs__nav-wrap::after {
    height: 1px;
  }
}
